package com.lyf.scm.common.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * description:
 *          需求计划指标枚举
 * @author: haodong
 * @data: 2020/8/7 19:41
 */
public enum DemandPlanTargetEnum {

    /**
     * 销售计划金额
     */
    SALES_PLAN_AMOUNT("sales_plan_amount","销售计划金额", 0),
    /**
     * 预测计划金额
     */
    FORECAST_PLAN_AMOUNT("forecast_plan_amount","预测计划金额", 0),
    /**
     * 销售计划量
     */
    SALES_PLAN_QTY("sales_plan_qty","销售计划量", 1),
    /**
     * 上次销售计划量
     */
    LAST_SALES_PLAN_QTY("last_predict_sales","上次销售计划量", 1),
    /**
     * 预测计划量
     */
    FORECAST_PLAN_QTY("forecast_plan_qty","预测计划量", 1),
    /**
     * 确认量
     */
    CONFIRM_QTY("confirm_qty","确认量", 1),
    /**
     * 上次确认量
     */
    LAST_CONFIRM_QTY("last_confirm_qty","上次确认量", 1),
    /**
     * 计划与确认差值
     */
    PLAN_CONFIRMED_DIFFERIN("predict_confirm_l4_difference","计划与确认差值", 1),
    /**
     * 计划与确认差异比例
     */
    PLAN_CONFIRMED_PROPORTION("predict_confirm_l4_scale","计划与确认差异比例", 1),

    /**
     * 安全库存量
     */
    SAFETY_STOCK_QTY("safety_stock_qty","安全库存量", 0),
    /**
     * 预约在途采购量
     */
    RESERVE_PURCHASE_QTY("reserve_purchase_qty","预约在途采购量", 0),
    /**
     * 实际销量
     */
    ACTUAL_SALES_QTY("actual_sales_qty","实际销量", 1),
    /**
     * 未履约采购量
     */
    NO_FULFIL_PURCHASE_QTY("no_fulfil_purchase_qty","未履约采购量", 0),
    /**
     * 当前实时库存
     */
    REAL_TIME_INVENTORY("real_time_inventory","当前实时库存", 0),

    /**
     * 区总确认目标
     */
    CONFIRM_TARGET2("confirm_target2","区总确认目标", 0),
    /**
     * 片总确认目标
     */
    CONFIRM_TARGET3("confirm_target3","片总确认目标", 0),
    /**
     * 地总确认目标
     */
    CONFIRM_TARGET4("confirm_target4","地总确认目标", 0);

    private String columns;
    private String desc;
    /**
     * 是否是需要导出的指标，0否1是
     */
    private int isNeedExportTarget;

    DemandPlanTargetEnum(String columns, String desc, int isNeedExportTarget) {
        this.columns = columns;
        this.desc = desc;
        this.isNeedExportTarget = isNeedExportTarget;
    }

    /**
     * 指标的枚举顺序为excel导出时候指标的顺序
     *
     * @param
     * @return {@link List <String>}
     **/
    public static List<String> getAllTargetsDesc() {
        List<String> targetsDesc = new ArrayList<>();
        for (DemandPlanTargetEnum item : DemandPlanTargetEnum.values()) {
            targetsDesc.add(item.getDesc());
        }
        return targetsDesc;
    }

    /**
     * 获取需要导出的指标
     *
     * @param
     * @return {@link List <String>}
     **/
    public static List<String> getNeedExportTargetsDesc() {
        List<String> targetsDesc = new ArrayList<>();
        for (DemandPlanTargetEnum item : DemandPlanTargetEnum.values()) {
            if (item.isNeedExportTarget == 1){
                targetsDesc.add(item.getDesc());
            }
        }
        return targetsDesc;
    }

    public static DemandPlanTargetEnum[] getNeedExportTargets() {
        List<DemandPlanTargetEnum> list = new ArrayList<>();
        for (DemandPlanTargetEnum item : DemandPlanTargetEnum.values()) {
            if (item.isNeedExportTarget == 1){
                list.add(item);
            }
        }
        DemandPlanTargetEnum[] arr = new DemandPlanTargetEnum[list.size()];
        return list.toArray(arr);
    }

    public String getColumns() {
        return columns;
    }

    public void setColumns(String columns) {
        this.columns = columns;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
